package com.bytedance.scenedemo.restore;

import com.bytedance.scene.Scene;
import com.bytedance.scene.ui.SceneAbility;
import ohos.utils.PacMap;

public class SupportRestoreAbility extends SceneAbility {
    private static PacMap inState;

    public static PacMap getInState() {
        return inState;
    }

    public static void setInState(PacMap inState) {
        SupportRestoreAbility.inState = inState;
    }

    @Override
    protected Class<? extends Scene> getHomeSceneClass() {
        SupportRestoreRootScene.setClickCount(0);
        return SupportRestoreRootScene.class;
    }

    @Override
    protected boolean supportRestore() {
        return true;
    }

    @Override
    public void onSaveAbilityState(PacMap outState) {
        super.onSaveAbilityState(outState);
        setInState(outState);
        outState.putIntValue("mClickCount", SupportRestoreRootScene.getClickCount());
    }

    @Override
    public void onRestoreAbilityState(PacMap inState) {
        super.onRestoreAbilityState(inState);
    }

}
